#include "Possibility.h"
#include <math.h>

#define FLT_EPSILON  exp(-10)


Possibility::Possibility(float possibilityValue)
:possibilityValue_m(possibilityValue)
{
}


const bool Possibility::operator==(const Possibility& possibilityB)
{
  return fabs(getPossibilityValue() - possibilityB.getPossibilityValue()) < FLT_EPSILON;
}

const Possibility  Possibility::operator!()
{
  return Possibility(1-getPossibilityValue());
}


const Possibility Possibility::operator*(const Possibility& possibilityB)
{
  return Possibility((getPossibilityValue()) * (possibilityB.getPossibilityValue()));
}

const Possibility Possibility::operator+(const Possibility& possibilityB)
{
  return Possibility((getPossibilityValue()) + 
                            (possibilityB.getPossibilityValue()) -
                            (getPossibilityValue() * 
                            (possibilityB.getPossibilityValue())));;
}

float Possibility::getPossibilityValue(void) const
{
  return possibilityValue_m;
}
